//
//  SopViewCell.m
//  DigiOps
//
//  Created by app on 2018/7/18.
//  Copyright © 2018年 俞渊华. All rights reserved.
//

#import "SopOptionViewCell.h"

@implementation SopOptionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
//    [self.sopInfo setBackgroundImage:[UIImage imageNamed:@"sop_info"] forState:UIControlStateNormal];
//    [self.sopInfo addTarget:self action:@selector(infoClick) forControlEvents:UIControlEventTouchUpInside];
    [self.okButton addTarget:self action:@selector(infoClick:) forControlEvents:UIControlEventTouchUpInside];
    //option靠左显示
    [self.okButton setBackgroundColor:XMColor(241, 245, 247)];
    self.okButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    self.okButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    
    UIButton *btn1 = [[UIButton alloc] init];
    btn1.tag = 1;
    [btn1 setTitle:@"" forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    btn1.titleLabel.font = [UIFont xm_medium:12];
    [btn1 setImage:[UIImage imageNamed:@"Down Arrow"] forState:UIControlStateNormal];
    btn1.imageEdgeInsets = UIEdgeInsetsMake(0, 50, 0, -40);
    btn1.contentEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
    [btn1 setBackgroundColor:[UIColor clearColor]];
    [btn1 addTarget:self action:@selector(infoClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.okButton addSubview:btn1];
    [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.okButton.mas_right);
        make.top.equalTo(self.okButton.mas_top);
        make.bottom.equalTo(self.okButton.mas_bottom);
        make.width.equalTo(@(SCREEN_WIDTH/2));
    }];
}
-(void)infoClick:(UIButton*)sender
{
    if (self.block) {
        self.block(sender);
    }
//    [sender setBackgroundColor:DGColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (SopOptionViewCell *)cellWithTableView:(UITableView *)tableView {
    static NSString *ID = @"SopOptionViewCellID";
    
    SopOptionViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[NSBundle mainBundle] loadNibNamed:@"SopOptionViewCell" owner:nil options:nil].lastObject;
        cell.backgroundColor=[UIColor whiteColor];
        
    }
    return cell;
}
@end
